"Pallavi" <pa*****@freejavahelp.com> wrote in message
news:16**************************@posting.google.c om...
Suppose I want to highlight a piece of text.
What do you mean by "highlight"? Are you just altering the
presentational style of an element, wrapping some text in a new inserted
element or using the browser's text selection capabilities (where
available)?
I get the x & y co-ordinates on the screen. And using
dhtml I am able to highlight the text.
Do you mean the screen co-ordinates? Usually, for DHTML work, either the
viewport co-ordinates or (more likely) the co-ordinates within the HTML
page are more relevant (as control over the window size and position is
not achievable outside of the controlled environment of an Intranet, and
not always even then).
I don't see a need for knowing the co-ordinates of anything in order to
highlight some text, unless you are using Range objects to select text.
Then I try on another machine with different resolution.
I am unable to get the relative position on the screen.
The relative position of what, and relative to what?
Can anyone guide me how to find the relative position on
different screen resolutions? Suppose i get the
position on 1024 X 768. What would be that position
on 800 X 600 or 640 X 480?
Generally it is possible to write HTML, and the JavaScript to interact
with it, totally independently of screen resolution/window size (indeed
it is advisable to always do exactly that as the page author has no
knowledge or control over either (even when they may believe that they
have)). Unfortunately, it would probably be possible to write a small
book about acquiring and using the relative co-ordinates of HTML
elements, text nodes and pointing devices and that is a bit of an
unrealistic expectation from a Usenet response.
You will have to narrow the subject to what is relevant to you situation
by going to the effort of comprehensively explaining your situation,
probably to the extent of making existing HTML and JavaScript code
available (though that could be just a cut-down version that adequately
demonstrated the problem rather than including code that has no baring).
Richard.